<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>车辆基础资料</title>
<link rel="stylesheet" type="text/css" href="<%=path%>/CSS/backLayout.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/CSS/bombBox.css">
<%-- <link href="<%=path%>/CSS/style.css" rel="stylesheet" type="text/css" /> --%>
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<script type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
<%@ include file="/WEB-INF/JSP/backHome/modalWindows/userListPage.jsp"%>
	<%@ include file="/WEB-INF/JSP/ajax.jsp"%>
<style type="text/css">
.seachform li label{line-height: 45px;color: #444444}
.scinput{line-height: 10px;margin-top: 5px}
.scinput1{margin-top: 5px;height: 30px;}
.scbtn{background: #57a0ff;border-radius:20px;width: 110px;margin-top: 4px;height: 35px;outline:none;}
.scbtn2{height: 20px;background: #57a0ff;border-radius:20px;width: 50px;color: #fff;display: none;}

thead {background: #f2f2f2}
tbody tr:nth-child(even) {background: #f7f8fd}
.tablelist th{height: 45px;padding-left: 30px;text-align: center;background: none;border-bottom: none;}
.tablelist td{border-right:none;padding-left: 30px;text-align: center;}
tbody tr{height: 38px}
.check{padding-left: 0px}
a{cursor: pointer;}
.placeul a{color: #444444} 
.success td{border-left:1px solid #dddee6;
	border-right: 1px solid #dddee6;}
.seachform{display: block; list-style-type: disc; -webkit-margin-before: 1em; -webkit-margin-after: 1em; -webkit-margin-start: 0px; -webkit-margin-end: 0px; -webkit-padding-start: 40px;}
.seachform { display: block; margin: 0; padding: 0; list-style: none; border-bottom:none }
.rightinfo { padding: 8px; font-size: 12px}
/* * { border: 0; margin: 0; padding: 0; } */
.scbtn { background: #57a0ff; border-radius: 20px; width: 110px; margin-top: 4px; height: 35px; outline: none;border: 0 }
.scbtn { width: 95px; height: 34px;  font-size: 14px; font-weight: bold; color: #fff; cursor: pointer; border-radius: 50px; behavior: url(js/pie.htc);}
.scinput { width: 150px; height: 30px; line-height: 30px; border-top: solid 1px #a7b5bc; border-left: solid 1px #a7b5bc; border-right: solid 1px #ced9df; border-bottom: solid 1px #ced9df; background: url(../images/inputbg.gif) repeat-x; text-indent: 10px; }
a, a:focus { text-decoration: none; color: #000; outline: none; blr: expression(this.onFocus=this.blur()); }
.seachform li { float: left; margin-right: 15px; }
li { display: block; margin: 0; padding: 0; list-style: none; }
.scinput1 { width: 150px; height: 30px; line-height: 30px; border-top: solid 1px #a7b5bc; border-left: solid 1px #a7b5bc; border-right: solid 1px #ced9df; border-bottom: solid 1px #ced9df; background: url(../images/inputbg.gif) repeat-x; text-indent: 10px; }
.placeul li:last-child { background: none; }
.seachform li label{margin-right: 10px}
.placeul li { float: left; line-height: 40px; padding-left: 7px; padding-right: 12px; background: url(../images/rlist.gif) no-repeat right;font-size: 9px }  
ul{border-bottom: none;}
.findBtn, .findBtn1, .findBtn2:hover {
    background: -webkit-linear-gradient(top, #8DC9EF, #4E9FD1);
    background: -moz-linear-gradient(top, #8DC9EF, #4E9FD1);
    background: linear-gradient(top, #8DC9EF, #4E9FD1);
    background: -ms-linear-gradient(top, #8DC9EF, #4E9FD1);
}
.findBtn, .findBtn1, .findBtn2 {
    background: #427dff, background;
    border-radius: 50px;
    background: -webkit-linear-gradient(top, #57a0ff, #57a1ff);
    background: -moz-linear-gradient(top, #57a0ff, #57a1ff);
    background: linear-gradient(top, #57a0ff, #57a1ff);
    background: -ms-linear-gradient(top, #57a0ff, #57a1ff);
    border: 1px solid #2576A8;
    box-shadow: 0 1px 2px #8AC1E2 inset, 0 -1px 0 #57a0ff inset;
    color: #fff;
    height: 40px;
    text-shadow: 1px 1px 0.5px #57a0ff;
    outline: none;
    margin-left: 100px;
    }
    input[type=checkbox]{
    float: left;
    margin-top: 8px;
    margin-right: 7px;
    }
</style>
</head>
<body style="background: #f5f5f5;padding: 0 10px;">
		<div class="place" style="background: #f5f5f5;margin-top: 10px">
			<ul class="placeul">
				<li><a href="#">报表</a></li>
				<li><a href="#">收银日报表</a></li>
			</ul>
		</div>
	
		<div class="rightinfo" style="background: #fff;border-radius:10px;min-height: 45px;float: left;margin-bottom: 20px;width:99.1%">

			<form action="<%=path%>/DrivingSys/selectCashDayJournalByCon" method="post" onsubmit="return onCheck()">
				<ul class="seachform" style="height: 20px">
					    <li style="margin-left: 15px"><label>培训收费</label>
					    	<c:if test="${trainCharge eq 1 }">
					    		<input id="trainCharge" checked="checked" type="checkbox" class="scinput"/>
					    	</c:if>
					    	<c:if test="${trainCharge ne 1 }">
					    		<input id="trainCharge" type="checkbox" class="scinput"/>
					    	</c:if>
					    	<input type="hidden"  style="float: left;" name="trainCharge" class="trainCharge"  >
					    </li>
					    <li><label>补考收费</label>
					    	<c:if test="${makeUpCharge eq 1 }">
					    		<input  id="makeUpCharge" checked="checked"  type="checkbox" class="scinput" />
					    	</c:if>
					    	<c:if test="${makeUpCharge ne 1 }">
					    		<input  id="makeUpCharge"  type="checkbox" class="scinput" />
					    	</c:if>
					    	<input type="hidden"   name="makeUpCharge" class="makeUpCharge" >
					    </li>
					    <li><label>一般收费</label>
					    	<c:if test="${charge eq 1 }">
					    		<input  id="charge"  checked="checked" type="checkbox" class="scinput"/>
					    	</c:if>
					    	<c:if test="${charge ne 1 }">
					    		<input  id="charge"  type="checkbox" class="scinput"/>
					    	</c:if>
					     	<input type="hidden"  name="charge" class="charge"  >
					    </li>
					     <li><label>自带车训练收费</label>
					     	<c:if test="${carCharge eq 1 }">
					    		<input  id="carCharge" checked="checked" type="checkbox" class="scinput" />
					    	</c:if>
					    	<c:if test="${carCharge ne 1 }">
					    		<input  id="carCharge"  type="checkbox" class="scinput" />
					    	</c:if>
					     	<input type="hidden"  name="carCharge" class="carCharge"  >
					    </li>
					     <li><label>考前模拟收费</label>
					     	<c:if test="${examCharge eq 1 }">
					    		<input  id="examCharge" type="checkbox" class="scinput" checked="checked"/>
					    	</c:if>
					    	<c:if test="${examCharge ne 1 }">
					    		<input  id="examCharge" type="checkbox" class="scinput" />
					    	</c:if>
					     	<input type="hidden"  name="examCharge" class="examCharge"  >
					    </li>			
					    <li><label>审核人</label>
					    <input  id="cfdepname"  type="text" name="cfdepname" class="scinput" value="${cfdepname}"/>
					    <input type="hidden"  name="cfdepeid" class="cfdepname" value="${cfdepeid}" >
					    </li>    
					    <li><label>开始时间</label><input class="scinput1"  name="beginTime" type="text" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}',dateFmt:'yyyy-MM-dd'})"
					    id="datemin" class="input-text Wdate" style="width:150px;" value="${beginTime}"></li>
						<li><label>结束时间</label><input class="scinput1"  name="endTime" type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd'})"
						id="datemax" class="input-text Wdate" style="width:150px;"value="${endTime}"></li>		
						<li><label>&nbsp;</label><input name="" type="submit"  style="outline: none;" class="scbtn" value="立即查询" /></li>
					<shiro:hasPermission name="/selectCashDayJournalByCon">
						<label>&nbsp;</label>
						<li style="height: 40px;text-align: left;color: #999999;">
				       &nbsp;<input type="button"  id="submitExcel" value="导出EXCLE" class="scbtn" >
							</li>
					</shiro:hasPermission>
				</ul>
			
			</form>
		</div>


		<div style="width: 100%;overflow:auto;margin-bottom: 0px;margin-top: 30px;background: #fff;border-radius:10px;min-height:600px">
		<form id="excel" action="<%=path%>/DrivingSys/outXls" method="post">
		<div  class="success">
			<div class='loading'>
			
			</div>
						<div style="min-height: 240px;width: 85%;padding-left: 20px;padding-top: 20px;">
						
								<table  width="100%" align="center" id="table"  style="border-collapse:collapse;min-height:30px;border-spacing:0;display: none;">
									<thead>
										<td style="width: 5px;height: 50px;background: rgb(228,234,254);"></td>
										<td style="width: 27px;height: 50px;background: rgb(228,234,254);" align="center">业务日期</td>
										<td style="width: 30px;height: 50px;background: rgb(228,234,254);" align="center">业务类型</td>
										<td style="height: 51px;background: rgb(228,234,254);" align="center">制单人</td>
										<td style="width: 25px;height: 50px;background: rgb(228,234,254);" align="center">单据编码</td>
										<td style="width: 23px;height: 50px;background: rgb(228,234,254);" align="center">单据状态</td>
										<td style="width: 23px;height: 51px;background: rgb(228,234,254);" align="center">现金</td>
										<td style="width: 24px;height: 51px;background: rgb(228,234,254);" align="center">刷卡</td>
										<td style="width: 26px;height: 50px;background: rgb(228,234,254);" align="center">银行转账</td>
										<td style="width: 24px;height: 50px;background: rgb(228,234,254);" align="center">合计</td>
										<td style="width: 29px;height: 50px;background: rgb(228,234,254);" align="center">备注</td>
									</thead>
									<c:forEach items="${charges}" var="charge"> 
									<tr style="border-left: 1px solid #c7c7c7;" id="two" >
										<td width="20px"></td>
										<td style="width: 20px;text-align: center;" align="center">${charge.fbizdate}</td>
										<td style="width: 20px;text-align: center;" align="center">${charge.mark}</td>
										<td style="width: 20px;text-align: center;" align="center">${charge.createName}</td>
										<td style="width: 20px;text-align: center;" align="center">${charge.fnumber}</td>
										<c:if test="${charge.cfbillstate eq 5}">
										<td style="width: 20px;text-align: center;" align="center">审核</td>
										</c:if>
										<c:if test="${charge.cfbillstate ne 5}">
										<td style="width: 20px;text-align: center;" align="center">保存</td>
										</c:if>
										<td style="width: 20px;text-align: center;" align="center">${charge.cfcash}</td>
										<td style="width: 20px;text-align: center;" align="center">${charge.cfcard}</td>
										<td style="width: 20px;text-align: center;" align="center">${charge.cfyhzz}</td>
										<td style="width: 20px;text-align: center;" align="center">${charge.cfyhzz+charge.cfcard+charge.cfcash}</td>	
										<td style="width: 20px;text-align: center;" align="center">${charge.cfremark}</td>							
									</tr>
									</c:forEach>				
									<tr class="endRow" style="font-weight: 700" >
										<td style="width: 10px;background: rgb(255,193,133);text-align: center;"></td>
										<td style="width: 20px;background: rgb(255,193,133);text-align: center;" align="center">总计</td>
										<td style="width: 20px;background: rgb(255,193,133);text-align: center;" align="center"></td>
										<td style="width: 20px;background: rgb(255,193,133);text-align: center;" align="center"></td>
										<td style="width: 20px;background: rgb(255,193,133);text-align: center;" align="center"></td>
										<td style="width: 20px;background: rgb(255,193,133);text-align: center;" align="center"></td>
										<td style="width: 20px;background: rgb(255,193,133);text-align: center;" align="center">${charge2.cfcash}</td>
										<td style="width: 20px;background: rgb(255,193,133);text-align: center;" align="center">${charge2.cfcard}</td>
										<td style="width: 20px;background: rgb(255,193,133);text-align: center;" align="center">${charge2.cfyhzz}</td>
										<td style="width: 20px;background: rgb(255,193,133);text-align: center;" align="center">${charge2.cfyhzz+charge2.cfcard+charge2.cfcash}</td>
										<td style="width: 20px;background: rgb(255,193,133);text-align: center;" align="center"></td>
									</tr>
								</table>
								
								<input id="xls" type="hidden" name="xls" value="">
                				<input type="hidden" value="收银日报表" name="fileNames">
								
						</div>
				</div>		
				 </form>
		</div>



		
</body>
<script type="text/javascript">

		function onCheck(){
            if($('#cfdepname').val() == ''){
                $('.cfdepname').val("")
            }
            //选中培训收费
            if($('#trainCharge').is(':checked'))
                $('.trainCharge').val("1")
            else $('.trainCharge').val("0")
            //补考收费
            if($('#makeUpCharge').is(':checked'))
                $('.makeUpCharge').val("1")
            else $('.makeUpCharge').val("0")
            //一般收费
            if($('#charge').is(':checked'))
                $('.charge').val("1")
            else $('.charge').val("0")

            if($('#carCharge').is(':checked'))
                $('.carCharge').val("1")
            else $('.carCharge').val("0")

            if($('#examCharge').is(':checked'))
                $('.examCharge').val("1")
            else $('.examCharge').val("0")
            flag = 0;
            $('.scinput').each(function(){
            if ($(this).is(":checked")) {
                flag = 1;       //操作
            }else{
            }
        })
        if(flag == 0){
            alert('请选择收费类型');
            return false;
        }else{
            return true;
        }

        }

        $('#submitExcel').live('click',function () {
            $('#excel').submit()
        })

		$(document).ready(function(){
		 
			function _w_table_rowspan_three(_w_table_id,_w_table_colnum,flag){
				
			    _w_table_firsttd = "";//需要合并的第一行
			    _w_table_currenttd = "";//当前行
			    _w_table_SpanNum = 0;//相同的行数
			/*     var num_person =0;//人员数量统计
			    var num_department=0;//部门数量统计 */
			    var length = $(_w_table_id).find('tr').length//表格的长度
			    _w_table_Obj = $(_w_table_id + " tr td:nth-child(" + _w_table_colnum + ")");	    	    
			    //需要增加的人员小计行	   
			    _w_table_Obj.each(function(i){
			    	//统计相同部门的数量
			    	/* if($(this).next().text() == '小计'){
			    		num_department+=Number($(this).next().parent().find("td:last").text())
			    	} */
			        if(i==0){
			            _w_table_firsttd = $(this);		            
			            _w_table_SpanNum = 1;
			            _td = $(this).parent().find('td:eq(1)');
			            _td3 = $(this).parent().find('td:eq(2)');
			            _td5 = $(this).parent().find('td:eq(3)');
			           /*  num_person = Number(_w_table_firsttd.parent().find("td:last").text())	 */            
			        }else{	        	
			            _w_table_currenttd = $(this);
			           /*  if (_w_table_SpanNum == 1) {
			            	num_person =Number( _w_table_firsttd.parent().find("td:last").text())
		                }	  */           
			            _td2 = $(this).parent().find('td:eq(1)');
			            _td4 = $(this).parent().find('td:eq(2)');
			            _td6 = $(this).parent().find('td:eq(3)');
	                    if ( _td.text() == _td2.text() && _td3.text() == _td4.text() && _td5.text() == _td6.text() ) {
	                    	
	                    	/* if(i == length-2){
	                    	var str='';//需要添加的行
			            	var str1 = ''
			            		 	 
		    	    	    str='<tr><td style="text-align: center; width: 2px;" class="xuhao"></td>'
		    	    	    	str+='<td style="text-align: center; width: 20px;background: rgb(210,255,187);" >'+_w_table_firsttd.prev().html()+'</td>'
		        	    		str+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" >小计</td>'
		        	    			str+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
			        	    			str+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
			        	    				str+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
			        	    					str+='<td style="text-align: center; width: 20px;background: rgb(210,255,187);" ></td>'
			        			    	    		str+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td></tr>'
			        			    	    		
			        	    	str1='<tr><td style="text-align: center; width: 2px;" class="xuhao"></td>'
		    	    			str1+='<td style="text-align: center; width: 20px;background: rgb(210,255,187);" >小计</td>'
		        	    		str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
		        	    			str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
		        	    				str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
		        	    					str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
		        	    						str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
			    	    		str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" class="num_department"></td></tr>'
			    	    		$(_w_table_id).append(str)	
			    	    		$(_w_table_id).append(str1)	
	                    	} */
	                        _w_table_SpanNum++;
	                        _w_table_currenttd.remove(); //remove();
	                        _w_table_firsttd.attr("rowSpan", _w_table_SpanNum);
			            }else{
			            	var str='';//需要添加的行
			            	var str1 = ''
		    	    	    str='<tr><td style="text-align: center; width: 2px;" ></td>'
		    	    	    	 str+='<td style="text-align: center; width: 20px;background: rgb(177,219,158);" >'+_w_table_firsttd.prev().prev().html()+'</td>'
		        	    		str+='<td style="text-align: center; width: 10px;background: rgb(177,219,158);" >'+_w_table_firsttd.prev().html()+'</td>'
		        	    			str+='<td style="text-align: center; width: 10px;background: rgb(177,219,158);" >小计</td>'
			        	    			str+='<td style="text-align: center; width: 10px;background: rgb(177,219,158);" ></td>'
			        	    				str+='<td style="text-align: center; width: 10px;background: rgb(177,219,158);" ></td>'
			        	    					str+='<td style="text-align: center; width: 20px;background: rgb(177,219,158);" ></td>'
			        	    						str+='<td style="text-align: center; width: 10px;background: rgb(177,219,158);" ></td>'
						        	    				str+='<td style="text-align: center; width: 10px;background: rgb(177,219,158);" ></td>'
						        	    					str+='<td style="text-align: center; width: 20px;background: rgb(177,219,158);" ></td>'
			        			    	    		str+='<td style="text-align: center; width: 10px;background: rgb(177,219,158);" ></td></tr>'
			        		if(_w_table_SpanNum == 1){		            		
			        			$(this).parent().prev().after(str)	 
			        		} 	    	
		    	    		if(_w_table_SpanNum != 1){
		    	    			
		    	    			$(this).parent().prev().after(str)	
		    	    			
		    	    		}   
		    	    		
			                _w_table_firsttd = $(this);
			                _td = $(this).parent().find('td:eq(1)');
			                _td3 = $(this).parent().find('td:eq(2)');
			                _td5 = $(this).parent().find('td:eq(3)');
			                _w_table_SpanNum = 1;
			             
			            }
			        }
			    }); 
			 
				
			}
			
			function _w_table_rowspan_two(_w_table_id,_w_table_colnum,flag){
			    _w_table_firsttd = "";//需要合并的第一行
			    _w_table_currenttd = "";//当前行
			    _w_table_SpanNum = 0;//相同的行数
			/*     var num_person =0;//人员数量统计
			    var num_department=0;//部门数量统计 */
			    var length = $(_w_table_id).find('tr').length//表格的长度
			    _w_table_Obj = $(_w_table_id + " tr td:nth-child(" + _w_table_colnum + ")");	    	    
			    //需要增加的人员小计行	   
			    _w_table_Obj.each(function(i){
			    	//统计相同部门的数量
			    	/* if($(this).next().text() == '小计'){
			    		num_department+=Number($(this).next().parent().find("td:last").text())
			    	} */
			        if(i==0){
			            _w_table_firsttd = $(this);		            
			            _w_table_SpanNum = 1;
			            _td = $(this).parent().find('td:eq(1)');
			            _td3 = $(this).parent().find('td:eq(2)');
			           /*  num_person = Number(_w_table_firsttd.parent().find("td:last").text())	 */            
			        }else{	        	
			            _w_table_currenttd = $(this);
			           /*  if (_w_table_SpanNum == 1) {
			            	num_person =Number( _w_table_firsttd.parent().find("td:last").text())
		                }	  */           
			            _td2 = $(this).parent().find('td:eq(1)');
			            _td4 = $(this).parent().find('td:eq(2)');
	                    if (_td.text() == _td2.text() && _td3.text() == _td4.text()) {
	                    	
	                    	/* if(i == length-1){
	                    	var str='';//需要添加的行
			            	var str1 = ''
			            		 	 
		    	    	    str='<tr><td style="text-align: center; width: 2px;" class="xuhao"></td>'
		    	    	    	str+='<td style="text-align: center; width: 20px;background: rgb(210,255,187);" >'+_w_table_firsttd.prev().html()+'</td>'
		        	    		str+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" >小计</td>'
		        	    			str+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
			        	    			str+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
			        	    				str+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
			        	    					str+='<td style="text-align: center; width: 20px;background: rgb(210,255,187);" ></td>'
			        			    	    		str+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td></tr>'
			        			    	    		
			        	    	str1='<tr><td style="text-align: center; width: 2px;" class="xuhao"></td>'
		    	    			str1+='<td style="text-align: center; width: 20px;background: rgb(210,255,187);" >小计</td>'
		        	    		str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
		        	    			str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
		        	    				str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
		        	    					str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
		        	    						str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
			    	    		str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" class="num_department"></td></tr>'
			    	    		$(_w_table_id).append(str)	
			    	    		$(_w_table_id).append(str1)	
	                    	} */
	                        _w_table_SpanNum++;
	                        _w_table_currenttd.remove(); //remove();
	                        _w_table_firsttd.attr("rowSpan", _w_table_SpanNum);
			            }else{
			            	var str='';//需要添加的行
		    	    	    str='<tr class="xuhao"><td style="text-align: center; width: 2px;" ></td>'
		    	    	    	str+='<td style="text-align: center; width: 20px;background: rgb(228,242,188);" >'+_w_table_firsttd.prev().html()+'</td>'
		        	    		str+='<td style="text-align: center; width: 10px;background: rgb(228,242,188);" >小计</td>'
		        	    			str+='<td style="text-align: center; width: 10px;background: rgb(228,242,188);" ></td>'
			        	    			str+='<td style="text-align: center; width: 10px;background: rgb(228,242,188);" ></td>'
			        	    				str+='<td style="text-align: center; width: 10px;background: rgb(228,242,188);" ></td>'
			        	    					str+='<td style="text-align: center; width: 20px;background: rgb(228,242,188);" ></td>'
			        	    						str+='<td style="text-align: center; width: 10px;background: rgb(228,242,188);" ></td>'
					        	    					str+='<td style="text-align: center; width: 20px;background: rgb(228,242,188);" ></td>'
					        	    						str+='<td style="text-align: center; width: 20px;background: rgb(228,242,188);" ></td>'
			        			    	    		str+='<td style="text-align: center; width: 10px;background: rgb(228,242,188);" ></td></tr>'
			        		if(_w_table_SpanNum == 1){		            		
			        			$(this).parent().prev().after(str)	 
			        		}
		    	    		if(_w_table_SpanNum != 1){
		    	    			
		    	    			$(this).parent().prev().after(str)	
		    	    			
		    	    		}   
		    	    		
			                _w_table_firsttd = $(this);
			                _td = $(this).parent().find('td:eq(1)');
			                _td3 = $(this).parent().find('td:eq(2)');
			                _w_table_SpanNum = 1;
			             
			            }
			        }
			    }); 
			    
			    
			}
	
			
			
			function _w_table_rowspan(_w_table_id,_w_table_colnum){     
	            _w_table_firsttd = "";     
	            _w_table_currenttd = "";     
	            _w_table_SpanNum = 0;     
	            _w_table_Obj = $(_w_table_id + " tr td:nth-child(" + _w_table_colnum + ")");     
	            _w_table_Obj.each(function(i){     
	                if(i==0){     
	                    _w_table_firsttd = $(this);     
	                    _w_table_SpanNum = 1;     
	                }else{     
	                    _w_table_currenttd = $(this);     
	                    if(_w_table_firsttd.text()==_w_table_currenttd.text()){     
	                        _w_table_SpanNum++;     
	                        _w_table_currenttd.remove(); //remove();     
	                        _w_table_firsttd.attr("rowSpan",_w_table_SpanNum);     
	                    }else{     
	                    	var str1 = ''
	                    	str1='<tr class="xuhao1" style="font-weight: 700" ><td style="text-align: center; width: 2px;" ></td>'
		    	    			str1+='<td style="text-align: center; width: 20px;background: rgb(210,255,187);" >小计</td>'
		        	    		str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
		        	    			str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
		        	    				str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
		        	    						str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
		        	    							str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
				        	    						str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
				        	    							str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
						        	    						str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" ></td>'
			    	    		str1+='<td style="text-align: center; width: 10px;background: rgb(210,255,187);" class="num_department"></td></tr>'
			    	    	
			    	    		if(_w_table_SpanNum != 1){
			    	    			$(this).parent().prev().after(str1)	
			    	    		}   
	                        _w_table_firsttd = $(this);     
	                        _w_table_SpanNum = 1;     
	                    }     
	                }     
	            });      
	            $('#table').show()
				$('.loading').hide()
	 	}     
			
			
		  _w_table_rowspan_three("#table", "4","1")    
		
		
		  _w_table_rowspan_two("#table", "3","1")      
			
		    
		     _w_table_rowspan("#table", "2")   
		    
		    

			 totalPrice = 0   //部门小计
			 bankPrice = 0	 //工时金额
			 skPrice = 0
			 cash = 0
			 totalPrice1 = 0   //部门小计
			 bankPrice1 = 0	 //工时金额
			 skPrice1 = 0
			 cash1 = 0
            totalPrice2 = 0
            bankPrice2 = 0
            skPrice2 = 0
            cash2 = 0
		    $('#table tr').each(function(i){
		    	if(i == 0){}
		    	else{
		    		$('.endRow').nextAll().remove()
					if($(this).hasClass("xuhao")){
                        totalPrice2 = $(this).prev().find("td:last").prev().html()
                        bankPrice2 = $(this).prev().find("td:last").prev().prev().html()
                        skPrice2 = $(this).prev().find("td:last").prev().prev().prev().html()
                        cash2 = $(this).prev().find("td:last").prev().prev().prev().prev().html()
                        $(this).find("td:last").prev().html(totalPrice2)
                        $(this).find("td:last").prev().prev().html(bankPrice2)
                        $(this).find("td:last").prev().prev().prev().html(skPrice2)
                        $(this).find("td:last").prev().prev().prev().prev().html(cash2)
					}
					if($(this).hasClass("xuhao1")){
						totalPrice1 = totalPrice1.toFixed(2)
						bankPrice1 = bankPrice1.toFixed(2)
						skPrice1 = skPrice1.toFixed(2)
						cash1 = cash1.toFixed(2)
						$(this).find("td:last").prev().html(totalPrice1)
						$(this).find("td:last").prev().prev().html(bankPrice1)
						$(this).find("td:last").prev().prev().prev().html(skPrice1)
						$(this).find("td:last").prev().prev().prev().prev().html(cash1)
						/*$(this).prev().children("td:last").prev().html(totalPrice2)
						$(this).prev().children("td:last").prev().prev().html(bankPrice2)
						$(this).prev().children("td:last").prev().prev().prev().html(skPrice2)
						$(this).prev().children("td:last").prev().prev().prev().prev().html(cash2)*/
						 totalPrice1 = 0   //部门小计
						 bankPrice1 = 0	 //工时金额
						 skPrice1 = 0
						 cash1 = 0
						}else{

							if($(this).find('td:eq(1)').html() == '小计'){
							    if(totalPrice == 0){
								}else {
								totalPrice = totalPrice.toFixed(2)
								bankPrice = bankPrice.toFixed(2)
								skPrice = skPrice.toFixed(2)
								cash = cash.toFixed(2)
                                totalPrice2 = totalPrice
                                skPrice2 = skPrice
                                bankPrice2 = bankPrice
								cash2 = cash
								$(this).find("td:last").prev().html(totalPrice)
								$(this).find("td:last").prev().prev().html(bankPrice)
								$(this).find("td:last").prev().prev().prev().html(skPrice)
								$(this).find("td:last").prev().prev().prev().prev().html(cash)
								/* totalCount = (totalCount-0) + (totalPrice-0);
								hourCount = (hourCount-0) + (bankPrice-0)
								tainCount = (tainCount-0) + (skPrice-0) */
								totalPrice = 0
								skPrice = 0
								bankPrice = 0
								cash = 0
                                }
						}else{
			    		totalPrice = totalPrice.toFixed(2)
						totalPrice = (totalPrice-0) +($(this).find("td:last").prev().html()-0)
						bankPrice = (bankPrice-0) + ($(this).find("td:last").prev().prev().html()-0)	
						skPrice = (skPrice-0) + ($(this).find("td:last").prev().prev().prev().html()-0)
						cash = (cash-0) + ($(this).find("td:last").prev().prev().prev().prev().html()-0)
						totalPrice1 = totalPrice1.toFixed(2)
						totalPrice1 = (totalPrice1-0) +($(this).find("td:last").prev().html()-0)
						bankPrice1 = (bankPrice1-0) + ($(this).find("td:last").prev().prev().html()-0)	
						skPrice1 = (skPrice1-0) + ($(this).find("td:last").prev().prev().prev().html()-0)
						cash1 = (cash1-0) + ($(this).find("td:last").prev().prev().prev().prev().html()-0)
					}
					}
				} 

			})
		    
		
			
			
			
			
			$('.subtn3').click(function(){
				   var dep = $('input:checkbox[name=person]:checked').parent()  
			        $('#cfdepname').val(dep.next().html())
					$('.cfdepname').val($('input:checkbox[name=person]:checked').val())
			        $('#modal-overlay').css('visibility', 'hidden')
			        $('.modal-data3').css('visibility', 'hidden')
			        $('input:checkbox[name=person]:checked').removeAttr("checked");

			})
			
            $('#cfdepname').click(function(){
            	$('#modal-overlay').css('visibility','visible') 
				$('.modal-data3').css('visibility','visible')
				
            })
			
			$('.btn').click(function () {
		    $('#modal-overlay').css('visibility', 'hidden')
		    $('.modal-data3').css('visibility', 'hidden')
		    $('.data3-checkbox:checkbox').removeAttr('checked');
		})
		$('#xls').val($('.success').html());
			
	    })
		
</script>
</html>